/**
 * 
 */
package com.java.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.java.entity.Student;
import com.java.mapper.StudentMapper;
import com.java.mapper.TeacherMapper;
import com.java.service.StudentService;

/**
* @author Kidney
* 创建时间：2019年5月3日 上午1:50:53
* Description:
*/
/**
 * @author KIDNEY
 *
 */
@Service("StudentServiceImpl")
public class StudentServiceImpl implements StudentService{

	@Autowired
	private StudentMapper sm;
	
	
	/* (non-Javadoc)
	 * @see com.java.service.StudentService#getCollege(java.lang.Integer)
	 */
	



	/* (non-Javadoc)
	 * @see com.java.service.StudentService#getCollege(java.lang.Integer)
	 */
	@Override
	public Integer getCollege(Integer userID) {
		// TODO Auto-generated method stub
		return sm.selectByPrimaryKey(userID).getCollegeid();
	}
	
	
	public Student getStudent(Integer userID) {
		// TODO Auto-generated method stub
		return sm.selectByPrimaryKey(userID);
	}
	



	/* (non-Javadoc)
	 * @see com.java.service.StudentService#allStudent()
	 */
	@Override
	public List<Student> allStudent() {
		// TODO Auto-generated method stub
		return sm.getAll();
	}


	/* (non-Javadoc)
	 * @see com.java.service.StudentService#insert(com.java.entity.Student)
	 */
	@Override
	public Integer insert(String username,Integer userid,String sex,  Integer collegeid,Integer grade) {
		// TODO Auto-generated method stub
		Student student = new Student();
		student.setCollegeid(collegeid);
		student.setGrade(grade);
		student.setSex(sex);
		student.setUserid(userid);
		student.setUsername(username);
		
		return sm.insertSelective(student);
	}


	/* (non-Javadoc)
	 * @see com.java.service.StudentService#delete(java.lang.Integer)
	 */
	@Override
	public Integer delete(Integer userid) {
		// TODO Auto-generated method stub
		return sm.deleteByPrimaryKey(userid);
	}
	

}
